package cn.tedu.image.service;

import cn.tedu.image.mapper.ImageRoMapper;
import cn.tedu.image.pojo.ImageRo;
import cn.tedu.image.vo.PageResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sun.javafx.iio.common.ImageTools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 本类用于
 * @author SJXQ
 * @version 2022/1/17 18:41
 */
@Service
public class ImageServiceImpl implements ImageService{

    @Autowired
    private ImageRoMapper imageRoMapper;

    @Override
    public void selectPage(PageResult pageResult) {
        IPage<ImageRo> iPage = new Page<>();
        iPage.setSize(pageResult.getPageSize());
        iPage.setCurrent(pageResult.getPageNum());
        QueryWrapper<ImageRo> imageRoQueryWrapper = new QueryWrapper<>();
        final IPage<ImageRo> page = imageRoMapper.selectPage(iPage, null);
        pageResult.setTotal(page.getTotal());
        pageResult.setData(page.getRecords());
    }
}
